local BASEVALUE = 5

function MineralValue(Mineral)	
	local Value = 0
	
	-- Abundant, level 1
	if(Mineral == "Ice") then
		Value = GetVal(1)
	end
	
	-- Common, level 2
	if(Mineral == "Iron") then
		Value = GetVal(2)
	end
	
	-- UnCommon, level 3
	
	if(Mineral == "Aluminum") then
		Value = GetVal(3)
	end
	if(Mineral == "Copper") then
		Value = GetVal(3)
	end
	if(Mineral == "Uranium") then
		Value = GetVal(3)
	end
	if(Mineral == "Titanium") then
		Value = GetVal(3)
	end
	
	-- Rare, level 4
	
	if(Mineral == "Lithium") then
		Value = GetVal(4)
	end
	
	-- Very rare, level 5
	
	if(Mineral == "Chromite") then
		Value = GetVal(5)
	end
	
	if(Mineral == "Plutonium") then
		Value = GetVal(5)
	end
	-- Precious, level 6
	
	if(Mineral == "Platinum") then
		Value = GetVal(6)
	end
	if(Mineral == "Mercury") then
		Value = GetVal(6)
	end
	if(Mineral == "Obsidian") then
		Value = GetVal(6)
	end
	if(Mineral == "Silver") then
		Value = GetVal(6)
	end
	if(Mineral == "Gold") then
		Value = GetVal(6)
	end
	if(Mineral == "Irdirium") then
		Value = GetVal(6)
	end
	
	return Value
end

function GetVal(Rarity)
	if(Rarity == 1) then
		return math.ceil(BASEVALUE * Rarity * (1/2))
	end
	if(Rarity == 2) then
		return math.ceil(BASEVALUE * Rarity * (2/2))
	end
	if(Rarity == 3) then
		return math.ceil(BASEVALUE * Rarity * (4/2))
	end
	if(Rarity == 4) then
		return math.ceil(BASEVALUE * Rarity * (6/2))
	end
	if(Rarity == 5) then
		return math.ceil(BASEVALUE * Rarity * (8/2))
	end
	if(Rarity == 6) then
		return math.ceil(BASEVALUE * Rarity * (10/2))
	end
	
	return 0
end
	
	--[[
		local MineralMulti = 1
	
	local Rarity, Difficulty
	local BaseValue = 100
	
	local AbundantPercent = 50
	local CommonPercent = 25
	local UncommonPercent = 20
	local RarePercent = 16
	local VeryRarePercent = 10
	local PreciousPercent = 7
	
	if(name == "ice") then
	Rarity = 1
	Dificulty = 1
	IceValue		= math.ceil(((BaseValue * rarity * Difficulty) / AbundantPercent) * MineralMulti)
	return IceValue
	end
	
	Rarity = 2
	Dificulty = 2
	IronValue 		= math.ceil(((BaseValue * rarity * Difficulty) / CommonPercent) * MineralMulti)
	
	Rarity = 3
	Dificulty = 4
	AluminiumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / UncommonPercent) * MineralMulti)
	CopperValue 	= math.ceil(((BaseValue * rarity * Difficulty) / UncommonPercent) * MineralMulti)
	UraniumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / UncommonPercent) * MineralMulti)
	TitaniumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / UncommonPercent) * MineralMulti)
	
	Rarity = 4
	Dificulty = 6
	LithiumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / RarePercent) * MineralMulti)
	
	Rarity = 5
	Dificulty = 8
	ChromiteValue 	= math.ceil(((BaseValue * rarity * Difficulty) / VeryRarePercent) * MineralMulti)
	PlutoniumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / VeryRarePercent) * MineralMulti)
	
	Rarity = 6
	Dificulty = 10
	PlatinumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / PreciousPercent) * MineralMulti)
	MercuryValue 	= math.ceil(((BaseValue * rarity * Difficulty) / PreciousPercent) * MineralMulti)
	ObsidianValue 	= math.ceil(((BaseValue * rarity * Difficulty) / PreciousPercent) * MineralMulti)
	SilverValue 	= math.ceil(((BaseValue * rarity * Difficulty) / PreciousPercent) * MineralMulti)
	GoldValue 		= math.ceil(((BaseValue * rarity * Difficulty) / PreciousPercent) * MineralMulti)
	IrdiriumValue 	= math.ceil(((BaseValue * rarity * Difficulty) / PreciousPercent) * MineralMulti)
	
	]]
	
	
	--[[
		AM.AddAsteroidResource("Ice",1,2000,5000,5)
		AM.AddAsteroidResource("Iron",2,5500,8000,8)
		AM.AddAsteroidResource("Titanium",3,5501, 6000,11)
		AM.AddAsteroidResource("Uranium",3,5001,6000,12)
		AM.AddAsteroidResource("Copper",3,7900,8500, 14)
		AM.AddAsteroidResource("Aluminium",3,601,1100,14)
		AM.AddAsteroidResource("Mercury",6,1100,1500, 15)
		AM.AddAsteroidResource("Iridium",6,6500,7000,16)
		AM.AddAsteroidResource("Plutonium",5,5800,6000,27)
		AM.AddAsteroidResource("Lithium",4,370,700,47)
		AM.AddAsteroidResource("Silver",6,150,490,65)
		AM.AddAsteroidResource("Gold",6,0,300,70)
		AM.AddAsteroidResource("Chromite",5,220,390,75)
		AM.AddAsteroidResource("Platinum",6,90,230,85)
		AM.AddAsteroidResource("Obsidian",6,750,800, 99) 
		
	AM.rarity_levels[1] = {name="Abundant", difficulty=1, minPercent=30, maxPercent=55}
	AM.rarity_levels[2] = {name="Common", difficulty=2, minPercent=15, maxPercent=25}
	AM.rarity_levels[3] = {name="Uncommon", difficulty=4, minPercent=10, maxPercent=20}
	AM.rarity_levels[4] = {name="Rare", difficulty=6, minPercent=8, maxPercent=16}
	AM.rarity_levels[5] = {name="Very rare", difficulty=8, minPercent=6, maxPercent=10}
	AM.rarity_levels[6] = {name="Precious", difficulty=10, minPercent=1, maxPercent=7}
	
	Base * rarity * difficulty / spawnpercent
	]]